﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>我的项目</title>
    <link href="~/Scripts/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-easyui/jquery.min.js"></script>
    <script src="~/Scripts/jquery-easyui/jquery.easyui.min.js"></script>
    <script src="~/Scripts/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
    <link href="~/Content/themes/icon.css" rel="stylesheet" />
    <script src="~/Content/js/common.js"></script>
    <link href="~/Content/themes/table.css" rel="stylesheet" />
    </head>
    <body>
  <script>
      openTabFormat = function (subtitle, url, icon) {
          var action = '<a href="javascript:void(0)" onclick="window.parent.addTab(\'{0}\',\'{1}\')">查看</a>';
          var htmls = stringFormat(action, subtitle, url);
          // console.log(htmls);
          return htmls;
      }
      $(function () {
          $("#myproject_dg").datagrid({       //初始化datagrid
              url: "/Project/GetAllPMInfo?view=PMMaintain&r=" + Math.random(),
              striped: true, rownumbers: true, pagination: true, pageSize: 10, singleSelect: true, fitColumns: true, fit: false,//自适应
              idField: 'ProjectID',
              sort: 'UpdateTime',
              order: 'desc',
              pageList: [10, 20, 30,40,50],
              frozenColumns: [[
                             {
                                 hidden: true,
                                 title: 'ID',
                                 field: 'ProjectID'
                             },
                               {
                                   width: '100',
                                   title: '项目编码',
                                   field: 'ProjectNo',
                                   formatter: function (value, row, index) {
                                       return value.length > 8 ? '<span title="' + value + '">' + value + '</span>' : value;
                                   }
                               },
                               {
                                   //width: '120',
                                   title: '项目名称',
                                   field: 'ProjectName',
                                   formatter: function (value, row, index) {
                                       return value.length > 8 ? '<span title="' + value + '">' + value + '</span>' : value;
                                   }
                               }

              ]],
              columns: [[
                   {
                       field: 'status', title: '状态', sortable: false, width: 45,
                       formatter: function (value, row, index) {
                           var x;
                           switch (value) {
                               case 0:
                                   x = "待确认";
                                   break;
                               case 1:
                                   x = "已确认";
                                   break;
                               case 2:
                                   x = "已下达";
                                   break;
                               case 3:
                                   x = "已结项";
                                   break;
                               case 5:
                                   x = "已终止";
                                   break;
                               default:
                                   x = value;
                                   break;
                           }
                           return x;
                           //return value == 1 ? '<img src="../../Content/themes/icon/chk_checked.gif" alt="已确认" title="项目已确认" />' : '<img src="../../Content/themes/icon/chk_unchecked.gif" alt="未确认" title="项目未确认" />';
                       }
                   },
                   {
                       width: 100, title: '操作', field: '_operate', formatter:
                   function (val, row, index) {
                       return openTabFormat('项目-' + row.ProjectName, '/Project/Index?view=pSearch&ProjectNo=' + row.ProjectNo)
                   }
                   },
               //{ field: 'Department', title: '部门', sortable: false, width: 50, hidden: false },
              //{
              //    field: 'ProjectClerk', title: '业务员', sortable: false,
              //    //width: 60,
              //    hidden: false
              //},
              //{
              //    field: 'ProjectManager', title: '管理员', sortable: false,
              //    //width: 60
              //},
              //{
              //    field: 'EstWorkTime', title: '预估工时', sortable: false, width: 80, formatter: function (value, row, index) {
              //        return parseFloat(value);//.toFixed(1);
              //    }
              //},
                //{ field: 'UpdateBy', title: '更新人', width: 60 },
                //{ field: 'UpdateTime', title: '更新时间', sortable: true, width: 70, formatter: getDate },
               
              ]],
              //toolbar: toolbar.length == 0 ? null : toolbar,
              //onSelect: function (rowIndex, rowData) {
              //    menuControl();
              //},
              onLoadSuccess: function (data) {

              }
          });
      });
    </script>  
        <table id="myproject_dg" data-options="fit:true,border:false"></table>
    </body>
    </html>
